<template>
	<view class="box w100 min100">
		<!-- <u-tabs-swiper ref="tabs" :list="tabslist" :current="current" inactive-color="#999999"
		 active-color="#333" :is-scroll="false" @change="tabsChange"></u-tabs-swiper> -->
		<empty v-if="list.length==0" text="暂无优惠券"></empty>
		<!-- <view :class="[current==2?'gray-2':'red','mr-20']"> -->
		<view class="list ptb-30 plr-25 mlr-36 mt-30 bg-white radius-10" :class="item.coupon_type==1?'list1 red':'list2 gray-2'" v-for="(item,i) in list" :key="i">
			<view class="" style="display: flex;">
				<view style="width:170rpx">
					<view>
						<text class="size-22">￥</text><text class="size-40">{{item.money}}</text>
					</view>
					<view class="size-26" >
						满{{item.use_money*1}}使用
					</view>
				</view>
				<view class=" size-24 ml-40">
					<view class="bold size-36">{{item.title}}</view>
					<view >有效期至</view>
					<view>{{item.end_time}}</view>
				</view>
			</view>
			<view class="quanbtn">{{current==0?"待使用":current==1?"已使用":"已过期"}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabslist: [{
					name: '未使用'
				}, {
					name: '已使用'
				}, {
					name: '已过期'
				}],
				current: 0,
				list: [],
				img1:'../../../static/coupon-1.png',
				img2:'../../../static/coupon-2.png',
				img3:'../../../static/coupon-3.png',
				// bgimg1:'../../../static/quan1.png',
				// bgimg2:'../../../static/quan2.png'
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			tabsChange(e) {
				this.current = e
				this.init()
			},
			init() {
				this.$http('user/coupon', {}, "POST").then(data => {
					console.log(data);
					this.list = data
				})
			}
			// init() {
			// 	this.$http('/addons/ddrive/user/coupon', {
			// 		type: this.current + 1
			// 	}, "POST").then(data => {
			// 		console.log(data);
			// 		this.list = data
			// 	})
			// }
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		background: #F8F8F8;
		overflow: hidden;
	}

	.list {
		position: relative;
		// background:url(../../../static/quan1.png);
		// background-size:cover;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.list1{
		background:url(../../../static/quan1.png);
		background-size:cover;
	}
	.list2{
		background:url(../../../static/quan2.png);
		background-size:cover;
	}
	.img{
		width: 80rpx;
		height: 80rpx;
		position: absolute;
		right: 10rpx;
		top: 10rpx;
		image{
			width: 100%;
			height: 100%;
		}
	}
	.list::before {
		position: absolute;
		content: "";
		width: 36rpx;
		height: 36rpx;
		border-radius: 50%;
		background: #f8f8f8;
		margin-top: -18rpx;
		top: 50%;
		left: -18rpx;
	}

	.list::after {
		position: absolute;
		content: "";
		width: 36rpx;
		height: 36rpx;
		border-radius: 50%;
		background: #f8f8f8;
		margin-top: -18rpx;
		top: 50%;
		right: -18rpx;
	}
	.quanbtn{
		// color: #FF4343;
		border-radius: 40rpx;
		width:150rpx;
		// height:60rpx;
		text-align: center;
		line-height: 60rpx;
	}
	.borderR{
		border:2rpx solid #FF4343;
	}
	.borderGray{
		border:2rpx solid #999;
	}
</style>
